﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

public class MissileStandard_10 : Missile
{
    GameObject m_MultiFireShip;

    int m_MagazineSize = 0;
    int m_MagazineSizeMax = 9;
    float m_ShotVelocity = 0.25f;
    float m_ContinueFireTimeCount = 0;
    public MissileStandard_10()
    {
        m_Price = 2450;
        m_Type = ItemsType.WEAPON_BIG_MISSILE_STANDARD_10;
        m_Speciality = Speciality.RUIN;
        ResearchInfluence = InfluenceMG.INFLUENCE_FIRE_STAR;
        m_DamageType = DamageType.TYPE_EXPLOSION;
        m_Level = Level.LEVEL_BIG;
        ShutRange = 15;
        m_TrunVelocity = 60;
        ShutVelocity = 22.4f;
        BulletFlyVelocity = 5f;
        Damage = 280f;
        m_Hp = 20;
        m_DropRate = 0.01f;
        m_Acceleration = 4;
        Name = "标准-10";
        Perview = "Textures/Weapon/WeaponBig/Standard-10";
        WeaponResource = "Perfabs/Weapon/Big/Standard-10";
        BulletResource = "Perfabs/Bullet/MissileStandard01";
        m_FireAudioResouce = "Perfabs/Audio/PuHu";
        Description = "标准系列内卷的结果，装载了9枚标准01火箭弹。";
    }

    public override FlyItem Fire(GameObject ship, WeaponSlot slot, Vector3 position, Vector3 direction)
    {
        Slot = slot;
        m_MultiFireShip = ship;
        m_MagazineSize = m_MagazineSizeMax;
        return null;
    }


    public override int update()
    {
        base.update();

        if (m_MagazineSize > 0)
        {
            m_ContinueFireTimeCount += Time.deltaTime;
            if (m_ContinueFireTimeCount >= m_ShotVelocity)
            {
                m_MagazineSize--;
                m_ContinueFireTimeCount = 0;
                base.Fire(m_MultiFireShip, Slot, Slot.transform.position, Slot.CurrentWeaponDirection);
            }
        }
        return 1;
    }
}